mod csv;
mod genpass;

use clap::Parser;
use self::{csv::CsvOpts, genpass::GenpassOpts};

pub use self::csv::OutputFormat;

// 基于结构体声明命令行参数, 使用clap::Parser宏
#[derive(Debug, Parser)]
// version, author, about的内容将从项目的Cargo.toml中获取
#[command(name = "rcli", version, author, about, long_about = None)]
pub struct Opts {
    // 子命令
    #[command(subcommand)]
    pub cmd: SubCommand,
}

#[derive(Debug, Parser)]
pub enum SubCommand {
    // 命令行形式: rcli csv 
    // 其中name表示命令的名称, about则是对该命令的描述信息
    #[command(name = "csv", about = "Show CSV, or convert CSV to other formats")]
    Csv(CsvOpts),
    // 子命令2: rcli genpass
    #[command(name = "genpass", about = "Generate a random password")]
    Genpass(GenpassOpts),
}